import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useQuestionStore = defineStore('question', () => {
  const history = ref<Array<{
    type: string
    content: string
    response: string
    timestamp: number
  }>>([])

  const settings = ref({
    defaultDifficulty: '中等',
    defaultCount: 5
  })

  const addToHistory = (item: {
    type: string
    content: string
    response: string
  }) => {
    history.value.push({
      ...item,
      timestamp: Date.now()
    })
  }

  const clearHistory = () => {
    history.value = []
  }

  return {
    history,
    settings,
    addToHistory,
    clearHistory
  }
}) 